Script Variables
Variables can be used to store values using a logical name. A value is assigned to a variable. After a value has been assigned, it can be recalled using the logical name of the variable.
Variables can be divided into three groups:
-
User-defined – Named and defined by the developer of the script.
-
Built-in – Describes the attributes of the graphical element (level, color, text size, text font, etc.), display system information (date and time) or control the execution of the script.
-
Database – Contains the attributes stored in a database table.
A variable must start with a letter followed by any combination of letters, numbers and underscore (_). Any special character (%, &, #, etc.) other than the underscore is not allowed. The logical name of a variable can be up to 40 characters.
Database variables use a special naming convention. The name of these variables consists of the name of the database table followed by a period and the name of the column (FEATURE.MSLINK).
Variables can store data of the following data types:
-
Integers
-
Floating-point numbers
-
Boolean / logical values (TRUE or FALSE)
-
Text
Example:
In the first example the integer value 3 is assigned to the variable a using the assignment operator (=).
In the second example the variable b is assigned the value of the expression a / 4. This expression is evaluated and produces the floating-point number 0.75 (3/4).
In the third example the variable c is assigned the value of the expression a > b (using the is greater than operator). This expression produces the Boolean result TRUE because a is greater than b (3 is greater than 0.75).
The value assigned to a variable is stored until it is modified in the script or when the script ends. It is possible to use arithmetic or logical expressions when assigning a value to a variable.